﻿Ext.define('GS.view.CategoryList', {
    extend: 'Ext.NestedList',
    xtype: 'categorylist',

    config: {

        title: 'Forum',
        iconCls: 'bookmarks',
        displayField: 'title',

        store: {
            type: 'tree',

            fields: [
                'title', 'id', 'leaf'
            ],

            root: {
                leaf: false
            },

            proxy: {
                type: 'jsonp',
                url: GS.util.Config.getServerUrl()+'GetCategories.php',
                reader: {
                    type: 'json',
                    rootProperty: 'items'
                }
            }
        },

        detailCard: {
            xtype: 'postindex',
        },

        listeners: {
            leafitemtap: function (me, list, index, target, record) {
                detailCard = me.getDetailCard();
                detailCard.updateList(record.data);
            }
        }
    }
});

